<template>
	<scroll ref="mescrollRef" @init="mescrollInit" :down="downOption"  @down="downCallback" :up="upOption" @up="upCallback" @emptyclick="emptyClick">
		<stop isBack>
			<view slot="content">设备列表</view>
		</stop>
		<view class="bcf padlr3 padtb2 bdtso">
			<search class="fs8 tac" placeholder="设备名称\编码\型号"  v-model="search" @search="doSearch()"></search>
		</view>
		<view class="flrc bcf pad3 bdtso bdbso fs8">
			<view class="flex1"><scondition @input="reload()" model="MachineStatus" v-model="where.eq.status" label="设备状态"></scondition></view>
			<view class="flex1"><scondition @input="reload()" model="MachineCategory" v-model="where.eq.category" label="设备类型"></scondition></view>
			<view class="flex1"><scondition @input="reload()" model="MachineGroup" v-model="where.eq.groups" label="设备标记"></scondition></view>
		</view>
		<view class="padlr3">
			<!-- @tap="goto('/pages/machine/machine_info?id='+item.id)" -->
			<view class="bcf pos-r mart3 pad2 round2 shadow animation-scale-up ofh" 
			@tap="mySlide(index)"  
			v-for="item,index in data" :key="item.id">
				<machine :item="item" ></machine>
				<sslide ref="mySlideBox">
					<view class="round3 bg-cyan tac padlr1 padb1">
						
						<view class="padlr5 padtb2" style="width: 20vw;"
						@tap="goto('/pages/machine/break_order?machine=' + item.id)">
						报修 <text class="fa fa-angle-right marl1"></text>
						</view>
						
						<view class="padlr5 padtb2 "  style="width: 20vw;"
						@tap="goto('/pages/machi_check/check_order_form?machine=' + item.id)">
						点检 <text class="fa fa-angle-right marl1"></text>
						</view>
						
						<view class="padlr5 padtb2" style="width: 20vw;"
						@tap="goto('/pages/machi_maintain/maintain_order_form?machine=' + item.id)">
						保养 <text class="fa fa-angle-right marl1"></text>
						</view>
						
						<view class="padlr5 padtb2 bg-white round3" style="width: 20vw;"
						@tap="goto('/pages/machine/machine_info?id=' + item.id)">
						信息 <text class="fa fa-angle-right marl1"></text>
						</view>
						
					</view>
				</sslide>
			</view>
		</view>
		<loading :loading="myIsLoading"></loading>
	</scroll>
</template>

<script>
	import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
	import List from '../../assets/js/list.js'
	import machine from '../../templete/machine/machine_list_com.vue'
	
	export default {
		mixins:[MescrollMixin],
		components:{machine},
		data() {
			let list = new List()
			return {
				list,
				where:{
					eq:{
						status:'',
						category:'',
						groups:'',
					}
				},
				search:"",
				data:[]
			}
		},
		methods: {
			reload(){
				this.showLoading()
				this.list.setData({_order:{id:"DESC"},_where:this.where,_search:this.search}).reload()
			},
			doSearch(){
				this.showLoading()
				this.list.setData({_order:{id:"DESC"},_where:this.where,_search:this.search}).reload()
			}
		},
		mounted() {
			this.list.initMescroll(this).setUrl('/api/machines').setData({_order:{id:"DESC"},_where:this.where,_search:this.search}).setCbFunc(res=>{
				this.data = res
				this.clearLoading()
			}).reload()
		},
		onShow() {
			this.list.reload()
		}
	}
</script>

<style>

</style>
